package ataques;

public class Ataque2 extends BaseAtaque {

	protected boolean[][] C,M,Y,K;
	protected int[][] supimp;
	
	public Ataque2(int w, int h, boolean[][] C, boolean[][] M, boolean[][] Y, boolean[][] K) {
		super(w,h);
		this.C = C;
		this.M = M;
		this.Y = Y;
		this.K = K;
		this.runAttack();
	}

	@Override
	public void runAttack() {
		this.supimp = this.superImposeTres(this.C, this.M, this.Y);
		int l = C.length, h = C[0].length;
		
		int color1,color2;
		
		for (int j=0;j<h/2;j++) 
		{
			for (int i=0;i<l/2;i++)
			{
				color1=this.supimp[2*i][2*j];
				color2=this.supimp[2*i+1][2*j];
				if(color1==color2)
				{
					color2=this.supimp[2*i][2*j+1];
				}
				
				if(((color1==0)&&(color2==7))||((color1==7)&&(color2==0)))	//if the color mixture is black & white -> GROUP 1
				{
					this.desc[i][j]=7; //lo pintamos negro (por ejemplo, es possible pintarlo en cualquier color)
				}
				if(((color1==6)&&(color2==1))||((color1==1)&&(color2==6)))	//if the color mixture is yellow & blue -> GROUP 2
				{
					this.desc[i][j]=1; //lo pintamos amarillo
				}
				if(((color1==5)&&(color2==2))||((color1==2)&&(color2==5)))	//if the color mixture is green & magenta -> GROUP 3
				{
					this.desc[i][j]=5; //lo pintamos verde
				}
				if(((color1==3)&&(color2==4))||((color1==4)&&(color2==3)))	//if the color mixture is red & cyan -> GROUP 4
				{
					this.desc[i][j]=3; //lo pintamos rojo
				}
				
			}
		}
	}

	
	
}
